$(function(){
    // 游客量同比分析 数据
    var M=new Date().getMonth()+1
    var D=new Date().getDate()-1
    D=D<10?'0'+D:D
    var monthSun=235
    var TD=230
    setInterval(()=>{
        monthSun+=16
        TD+=17
        $('#mounSun0').text(monthSun)
    },1440000)
    var selectDate = [`2018年${M}月${D}日`, `2019年${M}月${D}日`, `2020年${M}月${D}日`]
    var selectData = [651, 780, `${TD}`]
    // 节假日客流 数据
    var holidayData1=[8,24,30,28,16,10,25]
    var holidayData2=[6,20,26,24,8,12,20]
    var holidayData3=[1,1,1,2,1,0,0]
   // 未来七天
   var seventData1=[268, 128, 143,121, 142, 133, 165]//今年
   var seventData2=[893, 427, 477, 403, 473, 443, 550]//去年
   var sevenDate= []
   function getSeventDay(){
    // 判断今天是几号
    var today=new Date().getDate()
    var month=new Date().getMonth()+1
    var Tday=new Date().getDay()
    for(let i=0;i<7;i++){
        var day=today+i+1
        sevenDate.push(month+'-'+day)
        if(Tday+i+1==7){//周日
            seventData1[i]= seventData1[i]+300
            seventData2[i]= seventData2[i]+1000
        }
        if(Tday+i+1==6){//周六
            seventData1[i]= seventData1[i]+300
            seventData2[i]= seventData2[i]+1000
        }
    }
   }
   getSeventDay()
  
       // 重点景区客流数据定时更换
    var dataList=[
        // [0,0,0,18.85,54.54,70.36],
        // [344,395,51,18.89,54.58,70.40],[667,790,123,18.97,54.66,70.47],[867,1185,318,19.09,54.78,70.59],[1088,1580,492,19.24,54.94,70.75],[1412,1975,563,19.44,55.13,70.95],[1750,2370,620,19.68,55.37,71.19],[1905,2765,860,19.96,55.65,71.46],[1114,3160,2046,20.27,55.96,71.78],[427,3555,3128,20.63,56.32,72.13],[130,3950,3820,21.02,56.71,72.53],[80,3954,3954,21.42,57.11,72.92],
        // [0,3954,3954,21.41,57.11,73.32]
        [281,361,5018,90147,105526,7040],[282,362,5019,90148,105527,7140],[283,363,5020,90149,105528,7240],[284,364,5021,90150,105529,7340],[285,365,5022,90151,105530,7440],[286,366,5023,90152,105531,7540],
        [287,367,5024,90153,105532,7640],[288,368,5025,90154,105533,7740],
    ]
    var Times=0;
    var timerId;
    function getTimes(Times){
        for(let i=0;i<dataList.length;i++){
            if(i==Times){
                for(let j=0;j<dataList[i].length;j++){
                    $('.tourist-data>div').eq(j).find('.numberStyle').text(dataList[i][j])
                }
            }
        }
    }
    // if(timerId){
    //     clearInterval(timerId)
    // } else {
    //     timerId = setInterval(()=>{
    //         Times++
    //         if(Times==24){
    //             Times=0
    //         }
    //         getTimes(Times)
    //     },4000)
    // }
    // 游客量同比分析
    function myChart2_1() {
        var myChart = echarts.init(document.getElementById('flow-2-1'));

        option = {
            grid: {
                top: '16%',
                left: '1%',
                right: '1%',
                bottom: '8%',
                containLabel: true,
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'line'
                }
            },
            legend: {
                itemGap: 50,
                data: ['游客月数据' ],
                textStyle: {
                    color: '#f9f9f9',
                    borderColor: '#fff'
                },
            },
            xAxis: [{
                type: 'category',
                boundaryGap: true,
                axisLine: { //坐标轴轴线相关设置。数学上的x轴
                    show: true,
                    lineStyle: {
                        color: 'rgba(255,255,255,.3)'
                    },
                },
                axisLabel: { //坐标轴刻度标签的相关设置
                    textStyle: {
                        color: 'rgba(255,255,255,.6)',
                        margin: 15,
                    },
                },
                axisTick: {
                    show: false,
                },
                data:selectDate ,
            }],
            yAxis: [{
                type: 'value',
                min: 0,
                // max: 140,
                name:"(人次)",
                nameTextStyle:{
                    color:'#fff'
                },
                splitNumber: 7,
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#0a3256'
                    }
                },
                axisLine: {
                    show: false,
                },
                axisLabel: {
                    margin: 20,
                    textStyle: {
                        color: 'rgba(255,255,255,.6)',

                    },
                },
                axisTick: {
                    show: false,
                },
            }],
            series: [{
                type: 'line',
                // smooth: true, //是否平滑曲线显示
                // 			symbol:'circle',  // 默认是空心圆（中间是白色的），改成实心圆
                showAllSymbol: true,
                symbol: 'circle',
                symbolSize: 6,
                smooth: true,
                // lineStyle: {
                //     normal: {
                //         color:  chartColor[0], // 线条颜色
                //     },
                // },
                label: {
                    show: true,
                    position: 'top',
                    textStyle: {
                        color: '#fff',
                    }
                },
                itemStyle: {
                    normal: {
                        color: chartColor[0],

                    }
                },
                areaStyle: { //区域填充样式
                    normal: {
                        //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(0,154,120,1)'
                        },
                            {
                                offset: 1,
                                color: 'rgba(0,0,0, 0)'
                            }
                        ], false),
                        shadowColor: 'rgba(53,142,215, 0.9)', //阴影颜色
                        shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
                    }
                },
                data:selectData,
            }]
        };
        myChart.setOption(option);
    }
    // 未来7天客流预测
    function myChart3_1() {
        var myChart = echarts.init(document.getElementById('flow-3-1'));
        var fontColor = chartColor[0];
       
        var legendData = ['今年预测','去年同期']
        option ={
            grid: {
                left: '5%',
                right: '10%',
                top:'20%',
                bottom: '15%',
                containLabel: true
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },

            legend: {
                show:true,
                right:'10%',
                top:'20',
                icon: 'stack',
                itemWidth:10,
                itemHeight:10,
                textStyle:{
                    color:'#fff'
                },
                data:legendData
            },
            xAxis : [
                {
                    type : 'category',
                    boundaryGap : false,
                    axisLabel:{
                        color: fontColor
                    },
                    axisLine:{
                        show:true,
                        lineStyle:{
                            color:'#397cbc'
                        }
                    },
                    axisTick:{
                        show:false,
                    },
                    splitLine:{
                        show:true,
                        lineStyle:{
                            color:'#195384'
                        }
                    },
                    data:sevenDate
                }
            ],
            yAxis : {
                type : 'value',
                min:0,
                name:'(人次)',
                nameTextStyle:{
                    color:"#fff"
                },
                axisLabel : {
                    formatter: '{value}',
                    textStyle:{
                        color:'#2ad1d2'
                    }
                },
                axisLine:{
                    lineStyle:{
                        color:'#27b4c2'
                    }
                },
                axisTick:{
                    show:false,
                },
                splitLine:{
                    show:true,
                    lineStyle:{
                        color:'#11366e'
                    }
                }
            },
            series : [
                {
                    name:legendData[0],
                    type:'line',
                    symbol:'circle',
                    symbolSize: 8,
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color:'#0092f6',
                            lineStyle: {
                                color: "#0092f6",
                                width:1
                            },
                            areaStyle: {
                                //color: '#94C9EC'
                                color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                                    offset: 0,
                                    color: 'rgba(7,44,90,0.3)'
                                }, {
                                    offset: 1,
                                    color: 'rgba(0,146,246,0.9)'
                                }]),
                            }
                        }
                    },
                    markPoint:{
                        itemStyle:{
                            normal:{
                                color:'red'
                            }
                        }
                    },
                    data: seventData1
                },
                {
                    name:legendData[1],
                    type:'line',
                    symbol:'circle',
                    symbolSize: 8,
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color:'#00d4c7',
                            lineStyle: {
                                color: "#00d4c7",
                                width:1
                            },
                            areaStyle: {
                                //color: '#94C9EC'
                                color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                                    offset: 0,
                                    color: 'rgba(7,44,90,0.3)'
                                }, {
                                    offset: 1,
                                    color: 'rgba(0,212,199,0.9)'
                                }]),
                            }
                        }
                    },
                    data:seventData2
                },
            ]
        };
        myChart.setOption(option);
    }
    // 节假日客流
    function myChart4_1() {
        var myChart = echarts.init(document.getElementById('flow-4-1'));
        option = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            legend: {
                data: ['2018', '2019', '2020'],
                align: 'right',
                right: 10,
                textStyle: {
                    color: "#fff"
                },
                itemWidth: 10,
                itemHeight: 10,
                itemGap: 35
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [{
                type: 'category',
                data: ['元旦',
                    '春节',
                    '清明',
                    '劳动',
                    '端午',
                    '中秋',
                    '国庆'
                ],
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#063374",
                        width: 1,
                        type: "solid"
                    }
                },
                axisTick: {
                    show: false,
                },
                axisLabel: {
                    show: true,
                    textStyle: {
                        color: "#00c7ff",
                    }
                },
            }],
            yAxis: [{
                name:'(万人次)',
                type: 'value',
                min:0,
                max:50,
                splitNumber:7,
                axisLabel: {
                    formatter: '{value}'
                },
                axisTick: {
                    show: false,
                },
                axisLine: {
                    show: false,
                    lineStyle: {
                        color: "#00c7ff",
                        width: 1,
                        type: "solid"
                    },
                },
                splitLine: {
                    show:false,
                    lineStyle: {
                        color: "#063374",
                    }
                }
            }],
            series: [{
                name: '2018',
                type: 'bar',
                data: holidayData1,
                barWidth: 10, //柱子宽度
                barGap: 1, //柱子之间间距
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(0,228,255,1)'
                        }, {
                            offset: 1,
                            color: 'rgba(0,228,255,0)'
                        }]),
                        opacity: 1,
                    }
                }
            }, {
                name: '2019',
                type: 'bar',
                data: holidayData2,
                barWidth: 10,
                barGap: 1,
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(83,252,179,1)'
                        }, {
                            offset: 1,
                            color: 'rgba(83,252,179,0)'
                        }]),
                        opacity: 1,
                    }
                }
            }, {
                name: '2020',
                type: 'bar',
                data: holidayData3,
                barWidth: 10,
                barGap: 1,
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(255,89,89,1)'
                        }, {
                            offset: 1,
                            color: 'rgba(255,89,89,0)'
                        }]),
                        opacity: 1,
                    }
                }
            }]
        };
        myChart.setOption(option);
    }
    // 分时段客流接待
    function myChart1_1() {
        var myChart = echarts.init(document.getElementById('flow-1-1'));
        let fontColor = chartColor[0];
        let thisData= [12, 35, 60, 138, 256, 198, 186, 123, 80,64,18]
        option ={
            grid: {
                left: '5%',
                right: '10%',
                top:'20%',
                bottom: '15%',
                containLabel: true
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            xAxis : [
                {
                    type : 'category',
                    boundaryGap : false,
                    axisLabel:{
                        color: fontColor
                    },
                    axisLine:{
                        show:true,
                        lineStyle:{
                            color:'#397cbc'
                        }
                    },
                    axisTick:{
                        show:false,
                    },
                    splitLine:{
                        show:true,
                        lineStyle:{
                            color:'#195384'
                        }
                    },
                    data : ['8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00']
                }
            ],
            yAxis : {
                type : 'value',
                min:0,
                name:'(人次)',
                nameTextStyle:{
                    color:"#fff"
                },
                axisLabel : {
                    formatter: '{value}',
                    textStyle:{
                        color:'#2ad1d2'
                    }
                },
                axisLine:{
                    lineStyle:{
                        color:'#27b4c2'
                    }
                },
                axisTick:{
                    show:false,
                },
                splitLine:{
                    show:true,
                    lineStyle:{
                        color:'#11366e'
                    }
                }
            },
            series : [
                {
                    name:'客流量',
                    type:'line',
                    symbol:'circle',
                    symbolSize: 8,
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color:'#0092f6',
                            lineStyle: {
                                color: "#0092f6",
                                width:1
                            },
                            areaStyle: {
                                //color: '#94C9EC'
                                color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                                    offset: 0,
                                    color: 'rgba(7,44,90,0.3)'
                                }, {
                                    offset: 1,
                                    color: 'rgba(0,146,246,0.9)'
                                }]),
                            }
                        }
                    },
                    markPoint:{
                        itemStyle:{
                            normal:{
                                color:'red'
                            }
                        }
                    },
                    data: thisData
                }
            ]
        };
        myChart.setOption(option);
    }
    setTimeout(  myChart1_1(),1200);
    setTimeout( myChart2_1(),1400);
    setTimeout(myChart3_1(),1600);
    setTimeout(myChart4_1(),1800);
    // 游客量同比分析  年月日Tab栏点击事件
    $('#dateTab>a').click(function(){
        let index=$(this).index()
        $(this).addClass('active').siblings('a').removeClass('active')
        $(this).parents('.content-title').siblings('.content-left-main').find('.select-date-box').eq(index).removeClass('hot-hd')
        $(this).parents('.content-title').siblings('.content-left-main').find('.select-date-box').eq(index).siblings('.select-date-box').addClass('hot-hd')
        if(index==0){
            selectDate = [`2018年${M}月${D}日`, `2019年${M}月${D}日`, `2020年${M}月${D}日`]
            selectData = [651, 780, `${TD}`]
            myChart2_1()
        }
        if(index==1){
            selectDate = [`2018年${M}月`, `2019年${M}月`, `2020年${M}月`]
            selectData = [13182, 16727, `${monthSun}`]
            myChart2_1()
        }
        if(index==2){
            selectDate = ['2018年', '2019年', '2020年']
            selectData = [310482, 351753, 55826]
            myChart2_1()
        }

    })
    // 数字
    $('.numberStyle').leoTextAnimate({
        delay:1000, //延时出现时间
        autorun: true, //是否自动运行
        fixed: [',', ':', '.'], //
        start: '0'
    });
    //选择日
    laydate.render({
        elem: '#selectDate2', //指定元素
        theme: '#37B866',
        range: true,
        trigger: 'click',
        min: -10,
        max: 0
    });
    //选择月
    laydate.render({
        elem: '#selectMonth2', //指定元素
        theme: '#37B866',
        type: 'month',
        range: true,
        trigger: 'click',
    });
    //选择年
    laydate.render({
        elem: '#selectYear2', //指定元素
        theme: '#37B866',
        type: 'year',
        range: true,
        trigger: 'click',
    });
    // 选择方式列表(景区，酒店，旅行社) 下拉框初始化
    $(".chanye-type").M_select({
        // 手动添加下拉款图片（以html页面为起始位置写路径）
        "Img": "./assets/plugin/M_select/up6.png",
        "Img2": "./assets/plugin/M_select/down6.png",
        "radius": "4px",
        // "Title": "选择景区",
        "inputName": "selected_value",
        // 默认选中的值（参数值写需要选中的select的value值）
        "selected": "0",
        Succee: function () {
            var typeSite = $('#select-type').val()
            console.log(typeSite)
            if (typeSite == 0) {
                // window.location.href = "./chanye_jq.html";
            }
            if (typeSite == 1) {
                // window.location.href = "./chanye_jd.html";
            }
            if (typeSite == 2) {
                // window.location.href = "./chanye_lxs.html";
            }
        }
    });
    // 景区列表 下拉框初始化
    $(".scenic").M_select({
        // 手动添加下拉款图片（以html页面为起始位置写路径）
        "Img": "./assets/plugin/M_select/up6.png",
        "Img2": "./assets/plugin/M_select/down6.png",
        "radius": "4px",
        "Title": "选择景区",
        "inputName": "selected_value",
        // 默认选中的值（参数值写需要选中的select的value值）
        "selected": "2",
        Succee: function () {
          site = $('#select-scenic').val()
          console.log(site)
          if(site==0){
            window.location.href="./chanye_kl_dygz.html";
          }
          if(site==1){
            window.location.href="./chanye_kl_slq.html";
          }
          if(site==2){
            window.location.href="./chanye_kl.html";
          }
          if(site==3){
            window.location.href="./chanye_kl_stxz.html";
          }
          if(site==4){
            window.location.href="./chanye_kl_khs.html";
          }
          if(site==5){
            window.location.href="./chanye_kl_xlw.html";
          }
          if(site==6){
            window.location.href="./chanye_kl_jss.html";
          }
          if(site==7){
            window.location.href="./chanye_kl_jxlg.html";
          }
        }
      });


    // 点击按钮 切换热力图与eharts
    $('.title-btn').click(function(){
        let text=$(this).text()
        if(text=='热力图'){
            $(this).text('图表')
            $('.hot-box').removeClass('hot-hd')
            $('.hot-chart').addClass('hot-hd')
        }else{
            $(this).text('热力图')
            $('.hot-box').addClass('hot-hd')
            $('.hot-chart').removeClass('hot-hd')
        }
    })
    // 百度地图API功能
    var map = new BMap.Map("myHot");    // 创建Map实例
    map.centerAndZoom(new BMap.Point(113.002275,35.463496), 16);  // 初始化地图,设置中心点坐标和地图级别
    //添加地图类型控件
    map.addControl(new BMap.MapTypeControl({
        mapTypes: [
            BMAP_NORMAL_MAP,
            BMAP_HYBRID_MAP
        ]
    }));
    map.setCurrentCity("晋城");          // 设置地图显示的城市 此项是必须设置的
    map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
    var point = new BMap.Point(113.002275,35.463496);
    // map.centerAndZoom(point, 15);             // 初始化地图，设置中心点坐标和地图级别
    map.enableScrollWheelZoom(); // 允许滚轮缩放
    map.setMapStyle({style: 'midnight'})
    //默认地图样式(normal)
    //清新蓝风格(light)
    //黑夜风格(dark)
    //清新蓝绿风格(bluish)
    //高端灰风格(grayscale)
    //强边界风格(hardedge)
    //青春绿风格(darkgreen)
    //浪漫粉风格(pink)
    //午夜蓝风格(midnight)
    //自然绿风格(grassgreen)
    //精简风格(googlelite)
    //红色警戒风格(redalert)
    var points14 = [
        { "lng": 113.002131, "lat": 35.464327, "count": 98 },
        { "lng": 113.002149, "lat": 35.464055, "count": 100 },
        { "lng": 113.00241, "lat": 35.463423, "count": 90 },
        { "lng": 113.00241, "lat":35.463423, "count": 80 },
        { "lng": 113.00241, "lat": 35.463423, "count": 98 },
        { "lng": 113.00241, "lat": 35.463423, "count": 100 },
        { "lng": 113.001637, "lat": 35.460961, "count": 90 },
        { "lng": 113.048967, "lat": 34.502504, "count": 98 },
        { "lng": 113.001637, "lat": 35.460961, "count": 80 },
        { "lng": 113.001637, "lat": 35.460961, "count": 100 },
        { "lng": 113.001736, "lat": 35.46102, "count": 80 },
        { "lng": 113.0025, "lat": 35.463474, "count": 80 },
        { "lng": 113.002149, "lat": 35.464114, "count": 100 },
        { "lng": 113.002392, "lat":35.462526, "count": 80 },
        { "lng": 113.001889, "lat": 35.462343, "count": 80 },
        { "lng": 113.001871, "lat": 35.462034, "count": 80 },
        { "lng": 113.001745, "lat": 35.461086, "count": 100 },
        { "lng": 113.00144, "lat":35.461042, "count": 80 },
        { "lng": 113.002518,"lat": 35.46259, "count": 80 },
    ];
    var points13 = [
        { "lng": 113.002131, "lat": 35.464327, "count": 98 },
        { "lng": 113.002149, "lat": 35.464055, "count": 100 },
        { "lng": 113.00241, "lat": 35.463423, "count": 90 },
        { "lng": 113.00241, "lat":35.463423, "count": 80 },
        { "lng": 113.00241, "lat": 35.463423, "count": 98 },
        { "lng": 113.00241, "lat": 35.463423, "count": 100 },
        { "lng": 113.001637, "lat": 35.460961, "count": 90 },
        { "lng": 113.048967, "lat": 34.502504, "count": 98 },
        { "lng": 113.001637, "lat": 35.460961, "count": 80 },
        { "lng": 113.001637, "lat": 35.460961, "count": 100 },
        { "lng": 113.001736, "lat": 35.46102, "count": 80 },
        { "lng": 113.0025, "lat": 35.463474, "count": 80 },
        { "lng": 113.002149, "lat": 35.464114, "count": 100 },
        { "lng": 113.002392, "lat":35.462526, "count": 80 },
        { "lng": 113.001889, "lat": 35.462343, "count": 80 },
    ];
    var points12 = [
        { "lng": 113.002131, "lat": 35.464327, "count": 98 },
        { "lng": 113.002149, "lat": 35.464055, "count": 100 },
        { "lng": 113.00241, "lat": 35.463423, "count": 90 },
        { "lng": 113.00241, "lat":35.463423, "count": 80 },
        { "lng": 113.00241, "lat": 35.463423, "count": 98 },
        { "lng": 113.00241, "lat": 35.463423, "count": 100 },
        { "lng": 113.001637, "lat": 35.460961, "count": 90 },
        { "lng": 113.048967, "lat": 34.502504, "count": 98 },
        { "lng": 113.001637, "lat": 35.460961, "count": 80 },
        { "lng": 113.001637, "lat": 35.460961, "count": 100 },
        { "lng": 113.001736, "lat": 35.46102, "count": 80 },
    ];
    var points11 = [
        { "lng": 113.002131, "lat": 35.464327, "count": 98 },
        { "lng": 113.002149, "lat": 35.464055, "count": 100 },
        { "lng": 113.00241, "lat": 35.463423, "count": 90 },
        { "lng": 113.00241, "lat":35.463423, "count": 80 },
        { "lng": 113.00241, "lat": 35.463423, "count": 98 },
        { "lng": 113.00241, "lat": 35.463423, "count": 100 },
        { "lng": 113.001637, "lat": 35.460961, "count": 90 },
        { "lng": 113.048967, "lat": 34.502504, "count": 98 },
        { "lng": 113.001637, "lat": 35.460961, "count": 80 },
        { "lng": 113.001637, "lat": 35.460961, "count": 100 },
        { "lng": 113.001736, "lat": 35.46102, "count": 80 },
    ];
    var points10 = [
        { "lng": 113.002131, "lat": 35.464327, "count": 98 },
        { "lng": 113.002149, "lat": 35.464055, "count": 100 },
        { "lng": 113.00241, "lat": 35.463423, "count": 90 },
        { "lng": 113.00241, "lat":35.463423, "count": 80 },
        { "lng": 113.00241, "lat": 35.463423, "count": 98 },
        { "lng": 113.00241, "lat": 35.463423, "count": 100 },

    ];


    if (!isSupportCanvas()) {
        alert('热力图目前只支持有canvas支持的浏览器,您所使用的浏览器不能使用热力图功能~')
    }
    //详细的参数,可以查看heatmap.js的文档 https://github.com/pa7/heatmap.js/blob/master/README.md
    //参数说明如下:
    /* visible 热力图是否显示,默认为true
     * opacity 热力的透明度,1-100
     * radius 势力图的每个点的半径大小
     * gradient  {JSON} 热力图的渐变区间 . gradient如下所示
     *	{
            .2:'rgb(0, 255, 255)',
            .5:'rgb(0, 110, 255)',
            .8:'rgb(100, 0, 255)'
        }
        其中 key 表示插值的位置, 0~1.
            value 为颜色值.
     */
    heatmapOverlay = new BMapLib.HeatmapOverlay({ "radius": 20 });
    map.addOverlay(heatmapOverlay);
    // heatmapOverlay.setDataSet({ data: points2, max: 100 });
    //是否显示热力图
    function openHeatmap(data) {
        heatmapOverlay.show();
        heatmapOverlay.setDataSet({ data: data, max: 100 });
    }

    function closeHeatmap() {
        heatmapOverlay.hide();
    }

    function setGradient() {
        /*格式如下所示:
     {
         0:'rgb(102, 255, 0)',
         .5:'rgb(255, 170, 0)',
         1:'rgb(255, 0, 0)'
     }*/
        var gradient = {};
        var colors = document.querySelectorAll("input[type='color']");
        colors = [].slice.call(colors, 0);
        colors.forEach(function (ele) {
            gradient[ele.getAttribute("data-key")] = ele.value;
        });
        heatmapOverlay.setOption({ "gradient": gradient })
    }
    // 判断浏览器是否支持canvas
    function isSupportCanvas() {
        var elem = document.createElement('canvas');
        return !!(elem.getContext && elem.getContext('2d'))
    }
    openHeatmap(points14)
    // 点击切换热力图
    $('.time-list-box>div').click(function () {
        $(this).addClass('active').siblings().removeClass('active')
        switch ($(this).children('span').text()) {
            case '14':
                openHeatmap(points14)
                return;
            case '13':
                openHeatmap(points13)
                return;
            case '12':
                openHeatmap(points12)
                return;
            case '11':
                openHeatmap(points11)
                return;
            case '10':
                openHeatmap(points10)
                return;
        }

    })
})
